import { Component, OnInit, ViewEncapsulation, Input } from '@angular/core';
import {Router} from "@angular/router";
import {NavigationExtras} from "@angular/router/src/router";

@Component({
  selector: 'seed-order-goods',
  templateUrl: 'order-goods.component.html',
  styleUrls: ['order-goods.component.scss'],
  encapsulation: ViewEncapsulation.None,
})
export class OrderGoodsComponent implements OnInit {
  @Input() goodList;
  constructor(
    public router: Router,
  ) { }


  goServiceCardDetail(detail) {
    const cardStr = detail.serviceCardStepUrl.split('?')[1];
    const cardNo = cardStr.split('=')[1];
    if (detail.goodsCateCode1 && detail.goodsCateCode1 === 'V18' && cardNo) { // 跳转到票务服务卡页面
      const extras: NavigationExtras = {
        queryParams: {
          cardNo: cardNo
        }
      };

      this.router.navigate(['/goods/p/ticket-service'], extras);
    }else {
      this.router.navigate(['/goods', cardNo]);
    }

  }
  ngOnInit() {
  }

}
